<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE);
define('M_ROOT', substr(dirname(__FILE__), 0, -7));
$lic_file = M_ROOT.'./dynamic/license.cert';
$basefile = M_ROOT.'./base.inc.php';
if($lic_infos = @file($lic_file)){
	$lic_infos = array_filter($lic_infos);
	$lic_str = str_replace(array("\r","\n"),'',implode('-',$lic_infos));
	$fp = fopen($basefile,'r');
	$configfile = fread($fp, filesize($basefile));
	fclose($fp);
	$configfile = preg_replace("/[$]lic_str\s*\=\s*[\"'].*?[\"'];/is", "\$lic_str = '$lic_str';", $configfile);
	$fp = fopen($basefile, 'w');
	fwrite($fp, trim($configfile));
	fclose($fp);
}
exit('license updated !');
?>